package jax.io;

/**
 * ...
 * @author tom
 */
class JPrintStream extends JFilterOutputStream {
	static var NEW_LINE = "\n".charCodeAt(0);
	public function new (f:Dynamic, ?s:Dynamic) {
		if(s == null && Std.is(f, JOutputStream))
			super(f);
		else
			super(null);
	}		
	public function println(d:Dynamic) {
		var ts = Std.string(d);
		for(i in 0...ts.length) {
			this.write(ts.charCodeAt(i));
		}
		this.write(NEW_LINE);
		#if debug
			trace(ts + " wrote to print stream");
		#end
	}
}
